<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php if($meta_title != ''): echo ($meta_title); ?>-<?php endif; echo C('website.title');?></title>
<meta name="keywords" content="<?php echo C('website.keywords');?>"/>
<meta name="description" content="<?php echo C('website.desc');?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/public/Home/dist/css/zui.css">
<link rel="stylesheet" href="/public/Home/dist/css/zui-theme.css">
<link rel="stylesheet" href="/public/Home/common/css/style.css">
<script type="text/javascript" src="/public/Home/dist/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="/public/Home/dist/js/zui.js"></script>
<script type="text/javascript" src="/public/Home/dist/lib/layer/layer.js"></script>
<link rel="stylesheet" type="text/css" href="/public/Home/assets/css/simditor.css" />
<script type="text/javascript" src="/public/Home/assets/js/module.min.js"></script>
<script type="text/javascript" src="/public/Home/assets/js/hotkeys.min.js"></script>
<script type="text/javascript" src="/public/Home/assets/js/uploader.min.js"></script>
<script type="text/javascript" src="/public/Home/assets/js/simditor.min.js"></script>


</head>
<body>
<div class="header-index-fix"></div>
<div class="header">
    <div class="container-fixed">
        <div class="header-left">
            <a href="#"><img src="<?php echo getImgidpath(C('website.logo'));?>" alt=""></a>
        </div>
        <div class="header-right">
            <ul class="header-nav">
                <li <?php if($mark == 'index'): ?>class="active"<?php endif; ?>>
                    <a href="<?php echo U('index/index');?>">项目大厅</a>
                </li>
                <li <?php if($mark == 'rank'): ?>class="active"<?php endif; ?>>
                    <a href="<?php echo U('rank/index');?>">排行榜</a>
                </li>
                <li <?php if($mark == 'article'): ?>class="active"<?php endif; ?>>
                    <a href="<?php echo U('article/index');?>">资讯</a>
                </li>
                <li <?php if($mark == 'company'): ?>class="dropdown dropdown-hover active"<?php else: ?>class="dropdown dropdown-hover"<?php endif; ?>>
                    <a href="#" data-toggle="dropdown">企业服务 <span class="drop-arrow"></span></a>
                    <ul class="dropdown-menu drop-nav">
                        <li>
                            <a href="<?php echo U('bug/index');?>">漏洞认领</a>
                        </li>
                        <li>
                            <a href="<?php echo U('company/index');?>">入驻企业</a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown dropdown-hover">
                    <a href="#" data-toggle="dropdown">白帽服务 <span class="drop-arrow"></span></a>
                    <ul class="dropdown-menu drop-nav">
                        <li>
                            <a href="<?php echo U('index/index');?>">技术知识分享</a>
                        </li>
                        <li>
                            <a href="<?php echo U('index/index');?>">等级与福利</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="<?php echo U('bbs/index');?>">论坛</a>
                </li>
            </ul>
            <div class="header-user">
                <div class="user-btns">
                    <div class="dropdown">
                        <button class="btn btn-primary" type="button" data-toggle="dropdown">提交 <span class="caret"></span></button>
                        <ul class="dropdown-menu pull-right">
                            <li><a href="<?php echo U('bug/post');?>">提交漏洞</a></li>
                            <li class="divider"></li>
                            <li><a href="<?php echo U('project/post');?>">提交项目</a></li>
                        </ul>
                    </div>
                </div>
                <div class="user-login">
                    <?php if($_SESSION['user']== null): ?><a href="<?php echo U('user/login');?>">登录</a>
                    <a href="<?php echo U('user/register');?>">注册</a>
                    <?php else: ?>
                        <a href="<?php echo U('user/member');?>"><?php echo ($_SESSION['user']['username']); ?></a><?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>


    <div class="container" style="margin:50px auto;">
        <div class="row">
            <form class="form-horizontal">
                <div class="form-group">
                    <label for="exampleInputAccount7" class="col-lg-1">标题</label>
                    <div class="col-md-6 col-lg-11">
                        <input type="text" name="title" class="form-control" id="exampleInputAccount7" placeholder="请输入标题">
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword4" class="col-lg-1 required">类型</label>
                    <div class="col-md-6 col-lg-11">
                        <select class="form-control" name="section_id" id="exampleInputAddress1">
                            <?php if(is_array($titles)): $i = 0; $__LIST__ = $titles;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["title"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputAccount9" class="col-lg-1 required">作者</label>
                    <div class="col-md-6 col-lg-11">
                        <select class="form-control" name="user_id" id="exampleInputAddress2">
                                <option value="<?php echo ($user?$user['id']:'0'); ?>"><?php echo ($user?$user['username']:'游客'); ?></option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleInputAccount9" class="col-lg-1 required">内容</label>
                    <div class="col-md-6 col-lg-11">
                        <textarea id="editor" placeholder="" autofocus></textarea>
                        <script>
                            var editor = new Simditor({
                                textarea: $('#editor')
                            });
                        </script>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-lg-offset-1 col-lg-11">
                        <a  class="btn btn-primary" href="javascript:" onclick="onSub();">提交</a>
                    </div>
                </div>
            </form>
            <script>
            function onSub() {
            // 帐号
            var title = $('input[name=title]').val();
            var section_id = $('select[name=section_id] option:selected').val();
            var user_id=$('select[name=user_id] option:selected').val();
            var content=editor.getValue();
            $.ajax({
            type: "POST",
            url: '<?php echo U("bbs/baocun");?>',
            dataType: 'json',
            cache: false,
            data: {title: title, section_id: section_id, user_id:user_id,content:content},
            success: function(data) {
            location.href = "<?php echo U('bbs/index');?>";
            },
            error: function(xhr, status, error) {
            console.log(xhr);
            console.log(status);
            console.log(error);
            }
            });
            }

            </script>
        </div>
    </div>

<div class="footer">
    <div class="container">
        <div class="footer-list">
            <ul>
                <li><a href="<?php echo U('index/index');?>" target="_blank">项目大厅</a></li>
                <li><a href="<?php echo U('rank/index');?>" target="_blank">排行榜</a></li>
                <li><a href="<?php echo U('user/index');?>" target="_blank">个人主页</a></li>
                <li><a href="#" target="_blank">帮助中心</a></li>
            </ul>
        </div>

        <div class="footer-bom">
        	<div>
        		 <?php echo C('website.recard');?>	<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>  <?php echo C('website.copyright');?>
        	</div>
        </div>
    </div>
</div>


</body>
</html>